
#ifndef _DBACCESS_HPP
#define	_DBACCESS_HPP

#include "stdafx.hpp"

namespace bagprod { namespace finance { namespace SPS {
    
class DBAccess
{
public:
    ~DBAccess();
    DBAccess();
    void Initialize(std::string database, std::string priceTable,
        std::string stockTable, std::string host, std::string user,
        std::string pass, int port=3306);
 
    std::list<types::StockData*>& GetStockData(long stockId);
    std::list<types::Stock*>& GetStocks();
    
    // Mutators
    void set_priceDatabase(std::string name){ this->m_priceTable = name; }
    void set_stockDatabase(std::string name){ this->m_stockTable = name; }
private:
    mysqlpp::Connection m_connection;
    std::string m_priceTable;
    std::string m_stockTable;
};

}}} // Namespace
#endif	/* _DBACCESS_HPP */

